package com.local.user.feign;

import com.local.common.util.ResultUtil;
import com.local.user.pojo.User;
import com.local.user.pojo.UserListRequestParam;
import com.local.user.pojo.UserLockRequestParam;
import com.local.user.pojo.UserLoginRequestParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

@FeignClient("userservice")
public interface UserServiceFeign {

    /**
     * user列表数据接口，包括翻页（后台）
     * @param requestParam
     * @return
     */
    @GetMapping("/user/list")
    @ResponseBody
    public ResultUtil list(@RequestBody UserListRequestParam requestParam);

    /**
     * 锁定/解锁用户状态（后台）
     * @param requestParam
     * @return
     */
    @PostMapping("/user/lock")
    @ResponseBody
    public ResultUtil lock(@RequestBody UserLockRequestParam requestParam);


    /**
     * 通过用户名和密码查询用户，用于前台登录
     * @param requestParam
     * @return
     */
    @GetMapping("/user/getByLoginNamePassword")
    @ResponseBody
    public ResultUtil<User> getByLoginNamePassword(@RequestBody UserLoginRequestParam requestParam);


    /**
     * 在订单核对页面中，修改地址
     * @param user
     * @return
     */
    @PostMapping("/user/updateAddress")
    @ResponseBody
    public ResultUtil updateAddress(@RequestBody User user);
}
